<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>computed计算属性</title>
    <script src="node_modules/vue/dist/vue.js"></script>
</head>
<body>
<div id="app">
    <h2>
        日期为: {{ process }}
    </h2>
</div>
<script type="text/javascript">
    var app = new Vue({
        el: "#app",
        data: {
            date: new Date().getTime(),
        },
        computed: {
            process() {
                const date = new Date(this.date);
                return date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate();
            }
        }
    });
</script>
</body>
</html>